﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="NopSolutions.NopCommerce.Web.Administration.Modules.BannerControl"
    CodeBehind="Banner.ascx.cs" %>
<%@ Register TagPrefix="nopCommerce" TagName="ToolTipLabel" Src="ToolTipLabelControl.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="NumericTextBox" Src="NumericTextBox.ascx" %>

<div class="section-header">
    <div class="title">
        <img src="Common/ico-content.png" alt="" />
        Управление баннерами
    </div>
</div>
<asp:GridView ID="gvBanner" runat="server" AutoGenerateColumns="False" Width="100%" DataKeyNames="BannerID"
        OnRowDeleting="gvBanner_RowDeleting" OnRowDataBound="gvBanner_RowDataBound" OnRowCommand="gvBanner_RowCommand">
    <Columns>
        <asp:TemplateField HeaderText="Тип баннера">
                <ItemTemplate>
                    <asp:Label ID="lblBannerType" runat="server" Text=""></asp:Label>    
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Текущее изображение" ItemStyle-Width="30%">
                <ItemTemplate>
                    <asp:Image ID="iBanner" runat="server" AlternateText="pic" />
                    <asp:HiddenField ID="hfBannerId" runat="server" Value='<%# Eval("BannerID") %>' />
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Url"
                HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left">
                <ItemTemplate>
                    <asp:TextBox ID="txtUrl" runat="server" CssClass="adminInput" 
                      Text='<%# Eval("Url") %>' ValidationGroup="Banner" Width="250px"></asp:TextBox>    
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="<% $NopResources:Admin.ProductPictures.DisplayOrder %>"
                HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" Width="50px" ID="txtBannerDisplayOrder"
                        Value='<%# Eval("DisplayOrder") %>' RequiredErrorMessage="<% $NopResources:Admin.ProductFiles.DisplayOrder.RequiredErrorMessage %>"
                        RangeErrorMessage="<% $NopResources:Admin.ProductFiles.DisplayOrder.RangeErrorMessage %>"
                        ValidationGroup="Banner" MinimumValue="-99999" MaximumValue="99999">
                    </nopCommerce:NumericTextBox>
                </ItemTemplate>
            </asp:TemplateField>
        <asp:TemplateField HeaderText="Новое  изображение"
                HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left">
                <ItemTemplate>
                    <asp:FileUpload ID="fuNewPicture" CssClass="adminInput" runat="server"
                        ToolTip="Загрузить новый баннер" />
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="<% $NopResources:Admin.ProductPictures.Update %>"
                HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <asp:Button ID="btnUpdate" runat="server" CssClass="adminButton" Text="<% $NopResources:Admin.ProductPictures.Update %>"
                        ValidationGroup="Banner" CommandName="UpdateBanner" ToolTip="<% $NopResources:Admin.ProductPictures.Update %>" />
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="<% $NopResources:Admin.ProductPictures.Delete %>"
                HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <asp:Button ID="btnDeleteFile" runat="server" CssClass="adminButton" Text="<% $NopResources:Admin.ProductPictures.Delete %>"
                        CausesValidation="false" CommandName="Delete" ToolTip="<% $NopResources:Admin.ProductPictures.Delete %>" 
                        OnClientClick="return confirm('Пожалуйста подтвердите удаление');"/>
                </ItemTemplate>
         </asp:TemplateField>
    </Columns>
</asp:GridView>
<p>
        <strong>
            Добавить новый баннер
        </strong>
</p>
<table class="adminContent">
        <tr>
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblSelectBanner" Text="Выберите файл"
                    ToolTip="Выберите файл" ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <asp:FileUpload ID="fuBanner" CssClass="adminInput" runat="server" ToolTip="Файл баннера" />
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblUrl" Text="Url" ToolTip="Url"
                    ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <asp:TextBox ID="txtUrl" runat="server" CssClass="adminInput" ValidationGroup="UploadNewBanner"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblBannerDisplayOrder" Text="Порядок отображения" ToolTip="Порядок отображения"
                    ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" ID="txtBannerDisplayOrder"
                    Value="1" RequiredErrorMessage="Необходимо указать порядок отображения"
                    RangeErrorMessage="<% $NopResources:Admin.ProductFiles.New.DisplayOrder.RangeErrorMessage %>"
                    MinimumValue="-99999" MaximumValue="99999" ValidationGroup="UploadNewBanner">
                </nopCommerce:NumericTextBox>
            </td>
        </tr>

        <tr>
            <td class="adminTitle">
                <nopCommerce:ToolTipLabel runat="server" ID="lblBannerType" Text="Тип банера" ToolTip="Тип банера"
                    ToolTipImage="~/Administration/Common/ico-help.gif" />
            </td>
            <td class="adminData">
                <asp:RadioButtonList ID="rbBannerType" runat="server" RepeatColumns="3">
                    <asp:ListItem Value="1">Верхний центральный</asp:ListItem>
                    <asp:ListItem Value="2">Правый</asp:ListItem>
                    <asp:ListItem Value="3">Верхний, рядом с логотипом</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        
        <tr>
            <td colspan="2" align="left">
                <asp:Button runat="server" ID="btnUploadBanner" CssClass="adminButton" Text="<% $NopResources:Admin.ProductPictures.UploadButton.Text %>"
                    ValidationGroup="UploadNewBanner" OnClick="btnUploadBanner_Click"
                    ToolTip="Загрузить файл" />
            </td>
        </tr>
</table>